package com.study.usercenter.controller;

import com.study.usercenter.entity.UserEntity;
import com.study.usercenter.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping(value = "/user/info/{id}")
    public UserEntity getUserInfo(@PathVariable Integer id) {
        return userService.userInfo(id);
    }

    @RequestMapping(value = "/user/list")
    public List<UserEntity> getUserList() {
        return userService.userList();
    }

    @RequestMapping(value = "/health")
    public String healthCheck() {
        return "OK";
    }

}
